import { track, trigger } from "./effect.js"
import { TrackOperationType, TriggerOperationType } from "./operation.js"

export function ref(value) {
  return {
    get value() {
      track(this, TrackOperationType.GET, 'value')
      return value
    },
    set value(newValue) {
      value = newValue
      trigger(this, TriggerOperationType.SET, 'value')
    }
  }
}